import http from "./http.js";
import qs from "qs";
export const getAuth = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/index/getAuth", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const login = (data) => {
	return new Promise((resolve, reject) => {
		http
			.post("jok/login/login", qs.stringify(data))
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const adminList = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/admin/index", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const adminAddEdit = (data) => {
	return new Promise((resolve, reject) => {
		http
			.post("jok/admin/addEdit", qs.stringify(data))
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const adminGetDetail = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/admin/getDetail", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const adminSetStatus = (data) => {
	return new Promise((resolve, reject) => {
		http
			.post("jok/admin/setStatus", qs.stringify(data))
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const roleList = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/admin/roleIndex", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const getSelect = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/index/getSelect", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const roleAddEdit = (data) => {
	return new Promise((resolve, reject) => {
		http
			.post("jok/admin/roleAddEdit", qs.stringify(data))
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const roleGetDetail = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/admin/roleGetDetail", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const authList = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/auth/index", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const authAddEdit = (data) => {
	return new Promise((resolve, reject) => {
		http
			.post("jok/auth/addEdit", qs.stringify(data))
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};
export const authGetDetail = (params) => {
	return new Promise((resolve, reject) => {
		http
			.get("jok/auth/getDetail", {
				params: params,
			})
			.then((response) => {
				resolve(response);
			})
			.catch((err) => {
				reject(err);
			});
	});
};